package cn.itcast.sink;

import cn.itcast.util.HbaseUtil;
import org.apache.flink.streaming.api.functions.sink.SinkFunction;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.Table;

import java.util.List;

public class SinkHbase implements SinkFunction<List<Put>> {
    private String tableName;
    public SinkHbase(String tableName){
        this.tableName=tableName;
    }

    @Override
    public void invoke(List<Put> value, Context context) throws Exception {
        Table table = HbaseUtil.getTable(tableName);
        table.put(value);
    }
}
